import { propTypes } from "/@/utils/propTypes"
import type { TreeDataItem } from "ant-design-vue/es/tree"
export const treeProps = {
  /**
   * 标题
   */
  title: { type: String },
  showLine: { type: Boolean, default: true },
  showIcon: { type: Boolean, default: false },
  immediate: { type: Boolean, default: true },
  toolbar: { type: Boolean, default: true },
  search: { type: Boolean, default: true },
  expandedKeys: {
    type: Array as PropType<string[] | number[]>,
    default: () => [],
  },
  // defaultExpandLevel: { type: Number },
  treeData: {
    type: Array as PropType<TreeDataItem[]>,
  },
  /**
   * 加载树数据api
   */
  api: { type: Function as PropType<(arg?: any) => Promise<any>> },
  // 加载数数据api参数
  params: propTypes.any,
  // 搜索的字段, 当在输入框输入内容并进行搜索时候, 会将值赋值到该配置的字段上
  searchField: { type: String, required: false, default: "keyword" },
  // treeData: { type: Array, required: false },
  // 如果使能添加, 会展示添加下级
  enableAddChird: { type: Boolean, default: false },
  enableEdit: { type: Boolean, default: false },
  enableDelete: { type: Boolean, default: false },
  deleteApi: { type: Function as PropType<(arg?: any, successCallback?: Function) => any> },

  onClick: { type: Function as PropType<(...args) => any>, default: null },
}
